<?php
/**
 * @Author: xuzhiyi
 * @Date:   2016-02-16 20:57:17
 * @Last Modified by:   xuzhiyi
 * @Last Modified time: 2016-03-01 22:33:17
 * ------------------------------------------------ *
 * 文章                                        *
 * ------------------------------------------------ */
namespace Home\Model;


class ArticlesModel extends CommonModel{

	//分页查询
	public function getArticlesPage(){
		$pageSize = (int)I('pageSize',0);
        $m = M('articles');
	 	$sql = "select a.articleTitle,a.articleId,a.articleContent,a.isShow,a.createTime,c.catName,s.managerName
	 	    from __PREFIX__articles a,__PREFIX__article_cats c,__PREFIX__managers s 
	 	    where a.catId=c.catId and a.managerId = s.managerId ";
	 	if(I('catId')!='')$sql.=" and a.catId=".I('catId')."";
	 	if(I('articleTitle')!='')$sql.=" and articleTitle like '%".I('articleTitle')."%'";
	 	$sql.=' order by articleId desc';
		return $this->PQ($sql,0,$pageSize);
	}
}